Get
The standard application command Get is a request to return the value of an object or objects. The Finder version of the Get command is similar to the standard application command, except that in most cases the Finder simply returns a reference to objects or objects requested. For properties that consist
of a value (such as the Name property) rather than a reference (such as the Desktop property of the Finder application), the Finder returns the value. In all cases, the Finder assigns the value returned to the predefined variableresult
.SYNTAX
[ get ] referenceToObject [ as className ]PARAMETERS
- referenceToObject
A reference to an object whose value is to be returned in theresult
variable or a list of references.
Class: Reference or list of references- className
- A class identifier that specifies the desired value class for
the returned data.
Class: Class identifier
Default value: The default value class for the object or objectsRESULT
A reference or list of references to the requested objects or, in the case of properties that consist of a value, a value of either the object's default value class or the class specified by the className parameter, or a list of values of that class. If the Finder can't return data in the value class specified by the className parameter, it generates an error.If the referenceToObject parameter specifies a single object only (such as
name of window 1
), the result is a single value or reference. If the referenceToObject parameter refers to more than one object (such asitems in startup disk
), the result is a list of values or references. If the specified object doesn't exist, for example, if the reference isfolder "My Folder" in startup disk
and there is no folder of that name in the startup disk, the Finder generates an error.EXAMPLES
This script returns the sizes, in bytes, of the folders at the top level of the startup disk:
tell application "Finder" get size of folders in startup disk end tell --result: {27636, 1438359, 1774813}This script returns a list of references to the folders at the top level of the startup disk:
tell application "Finder" get folders in startup disk end tell --result: folder "Projects" of startup disk of application "Finder", folder "Financial" of startup disk of application "Finder", folder "Applications" of startup disk of application "Finder"NOTES
The wordget
in the Get command is optional. For example, these statements are equivalent:
name of startup disk get name of startup disk